<%@page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>

<%@page import="java.sql.Connection,
java.sql.PreparedStatement,
java.sql.ResultSet,
java.sql.SQLException,
java.sql.Statement,
java.util.ArrayList,
java.util.Date,
java.util.List"
%>
<%@page import= "edu.gdut.imis.goods.common.*"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>会员信息</title>
    <link rel="shortcut icon" href="favicon1.ico" />
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/register.css">
    <style>
        form{
           
            float: left;
        }
    </style>
</head>
<body>
	
	<%
	
	
	response.setContentType("text/html;charset=utf-8");
	request.setCharacterEncoding("utf-8");
	String id= request.getParameter("uid");
	String oid = request.getParameter("oid");
	
	
	
	if(!id.equals("")&&!id.equals("null")) {
        int uid= Integer.parseInt(id); 
		Connection conn = null;
		PreparedStatement pstmt = null;	
		try {
		
			conn = DBConnector.getConn();
	
	
			String sql = "SELECT* FROM order_info WHERE uid=(?)";
		
			pstmt = conn.prepareStatement(sql);
			pstmt.setInt(1, uid);
	
			ResultSet rs = pstmt.executeQuery();
		
				while(rs.next()){
					uid = rs.getInt(1);		
					oid = rs.getString(2);
					String name = rs.getString(3);
					int quantity =rs.getInt(4);	
	    			float price = rs.getFloat(5);  			
	    			String time = rs.getString(6);
	    			String remarks = rs.getString(7);
                    String status = rs.getString(8);
                    
    				%>
    		<div class="reg_form w">
                <form action="/Goods/OrderModifyServlet" method="post">
    				  <ul>                 
                        <li><label for="">用户ID:</label><input type="text" class="inp"  name="uid" readonly="readonly" value="<%=uid%>"></li>     
                        <li><label for="">订单号:</label><input type="text" class="inp" name="oid" value="<%=oid%>" ></li>       
                        <li><label for="">名称:</label><input type="text" class="inp" name="name" value="<%=name%>" ></li>
                        <li><label for="">数量:</label><input type="text" class="inp" name="quantity" value="<%=quantity%>" ></li>
                        <li><label for="">价格:</label><input type="text" class="inp" name="price" value="<%=price%>" ></li>
                        <li><label for="">时间:</label><input type="text" class="inp" name="time" value="<%=time%>" ></li>
                        <li><label for="">评论:</label><input type="text" class="inp" name="remarks" value="<%=remarks%>" ></li>
                        <li><label for="">状态:</label><input type="text" class="inp" name="status" value="<%=status%>" ></li>
                        <li ><input type="submit" class="complete" value="确认修改"></li>
                    </ul>
                 </form>
                
            </div>
    				<% 	
				}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		try {
			conn.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		
}else if(!oid.equals("")&&!oid.equals("null")){
    Connection conn = null;
		PreparedStatement pstmt = null;	
		try {
		
			conn = DBConnector.getConn();
	
	
			String sql = "SELECT* FROM order_info WHERE oid=(?)";
		
			pstmt = conn.prepareStatement(sql);
			pstmt.setString(1, oid);
	
			ResultSet rs = pstmt.executeQuery();
		
				while(rs.next()){
					int uid = rs.getInt(1);		
					oid = rs.getString(2);
					String name = rs.getString(3);
					int quantity =rs.getInt(4);	
	    			float price = rs.getFloat(5);  			
	    			String time = rs.getString(6);
	    			String remarks = rs.getString(7);
                    String status = rs.getString(8);
                    
    				%>
    		<div class="reg_form w">
                <form action="/Goods/OrderModifyServlet" method="post">
    				  <ul>                 
                        <li><label for="">用户ID:</label><input type="text" class="inp"  name="uid" readonly="readonly" value="<%=uid%>"></li>     
                        <li><label for="">订单号:</label><input type="text" class="inp" name="oid" value="<%=oid%>" ></li>       
                        <li><label for="">名称:</label><input type="password" class="inp" name="name" value="<%=name%>" ></li>
                        <li><label for="">数量:</label><input type="text" class="inp" name="quantity" value="<%=quantity%>" ></li>
                        <li><label for="">价格:</label><input type="text" class="inp" name="price" value="<%=price%>" ></li>
                        <li><label for="">时间:</label><input type="text" class="inp" name="time" value="<%=time%>" ></li>
                        <li><label for="">评论:</label><input type="text" class="inp" name="remarks" value="<%=remarks%>" ></li>
                        <li><label for="">状态:</label><input type="text" class="inp" name="status" value="<%=status%>" ></li>
                        <li ><input type="submit" class="complete" value="确认修改"></li>
                    </ul>
                 </form>
                
            </div>
    				<% 	
				}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		try {
			conn.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
}
	
	%>

                   
   
</body>
</html>>